package com.orhon.smartcampus.modules.material.fetcher;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.orhon.smartcampus.modules.material.mutation.AddBuildingMutation;
import com.orhon.smartcampus.modules.material.mutation.AddCampusMutation;
import com.orhon.smartcampus.modules.material.mutation.AddFloorMutation;
import com.orhon.smartcampus.modules.material.mutation.AddRoomMutation;
import com.orhon.smartcampus.modules.material.mutation.AddSiteMutation;
import com.orhon.smartcampus.modules.material.mutation.AddUnitMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteBuildingMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteCampusMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteFloorMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteRoomMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteSiteMutation;
import com.orhon.smartcampus.modules.material.mutation.DeleteUnitMutation;

import graphql.schema.idl.RuntimeWiring;

@Component
public class MaterialFetchersLoader {

	@Autowired
	AddRoomMutation addRoomMutation;

	@Autowired
	DeleteRoomMutation deleteRoomMutation;

	@Autowired
	AddFloorMutation addFloorMutation;

	@Autowired
	DeleteFloorMutation deleteFloorMutation;

	@Autowired
	AddUnitMutation addUnitMutation;

	@Autowired
	DeleteUnitMutation deleteUnitMutation;


	@Autowired
	AddBuildingMutation addBuildingMutation;

	@Autowired
	DeleteBuildingMutation deleteBuildingMutation;

	@Autowired
	AddSiteMutation addSiteMutation;

	@Autowired
	DeleteSiteMutation deleteSiteMutation;

	@Autowired
	AddCampusMutation addCampusMutation;

	@Autowired
	DeleteCampusMutation deleteCampusMutation;


	@Autowired
	BuildingFetcher buildingFetcher;
	@Autowired
	BuildingListFetcher buildingListFetcher;

	@Autowired
	CampusFetcher campusFetcher;
	@Autowired
	CampusListFetcher campusListFetcher;

	@Autowired
	FloorFetcher floorFetcher;
	@Autowired
	FloorListFetcher floorListFetcher;

	@Autowired 
	RoomFetcher roomFetcher;
	@Autowired
	RoomListFetcher roomListFetcher;

	@Autowired
	SiteFetcher siteFetcher;
	@Autowired
	SiteListFetcher siteListFetcher;

	@Autowired
	UnitFetcher unitFetcher;
	@Autowired
	UnitListFetcher unitListFetcher;
	
	@Autowired
	DormitoryStudentsFetcher dormitoryStudentsFetcher;
	
	public void LoadFetchers(RuntimeWiring.Builder builder){

		builder.type("Query" , t->t.dataFetcher("Buildings" , buildingListFetcher));
		builder.type("Query" , t->t.dataFetcher("Building" , buildingFetcher));
		builder.type("Query" , t->t.dataFetcher("Campuses" , campusListFetcher));
		builder.type("Query" , t->t.dataFetcher("Campus" , campusFetcher));
		builder.type("Query" , t->t.dataFetcher("Floors" , floorListFetcher));
		builder.type("Query" , t->t.dataFetcher("Floor" , floorFetcher));
		builder.type("Query" , t->t.dataFetcher("Rooms" , roomListFetcher));
		builder.type("Query" , t->t.dataFetcher("Room" , roomFetcher));
		builder.type("Query" , t->t.dataFetcher("Sites" , siteListFetcher));
		builder.type("Query" , t->t.dataFetcher("Site" , siteFetcher));
		builder.type("Query" , t->t.dataFetcher("Units" , unitListFetcher));
		builder.type("Query" , t->t.dataFetcher("Unit" , unitFetcher));
		builder.type("Query" , t->t.dataFetcher("DormitoryStudents" , dormitoryStudentsFetcher));
		

		builder.type("Mutation" , t->t.dataFetcher("addRoom" , addRoomMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteRoom" , deleteRoomMutation));
		builder.type("Mutation" , t->t.dataFetcher("addFloor" , addFloorMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteFloor" , deleteFloorMutation));
		builder.type("Mutation" , t->t.dataFetcher("addUnit" , addUnitMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteUnit" , deleteUnitMutation)); 
		builder.type("Mutation" , t->t.dataFetcher("addBuilding" , addBuildingMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteBuilding" , deleteBuildingMutation));
		builder.type("Mutation" , t->t.dataFetcher("addSite" , addSiteMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteSite" , deleteSiteMutation));
		builder.type("Mutation" , t->t.dataFetcher("addCampus" , addCampusMutation));
		builder.type("Mutation" , t->t.dataFetcher("deleteCampus" , deleteCampusMutation));

	}


}
